home *** CD-ROM | disk | FTP | other *** search
/ CD BIT 75 / CD BIT 75.iso / Software / mysql-4.0.22-win / data1.cab / Development / scripts / make_win_binary_distribution < prev    next >
Encoding:
Text File  |  2004-10-28  |  4.3 KB  |  182 lines

  1. #!/bin/sh
  2.  
  3. #
  4. # Script to create a Windows binary package
  5. #
  6. # This is intended to be used under Cygwin, and will generate
  7. # an archive named in the form mysql<suffix>-<version>-noinstall.zip
  8.  
  9. version=4.0.22
  10.  
  11. DEBUG=0
  12. SUFFIX=""
  13. DIRNAME=""
  14. EXTRA=""
  15.  
  16. #
  17. # This script must run from MySQL top directory
  18. #
  19.  
  20. if [ ! -f scripts/make_win_binary_distribution ]; then
  21.   echo "ERROR : You must run this script from the MySQL top-level directory"
  22.   exit 1
  23. fi
  24.  
  25. #
  26. # Debug print of the status
  27. #
  28.  
  29. print_debug()
  30. {
  31.   for statement
  32.   do
  33.     if [ "$DEBUG" = "1" ] ; then
  34.       echo $statement
  35.     fi
  36.   done
  37. }
  38.  
  39. #
  40. # Usage of the script
  41. #
  42.  
  43. show_usage()
  44. {
  45.   echo "MySQL utility script to create a Windows binary package"
  46.   echo ""
  47.   echo "This is intended to be used under Cygwin, and will generate"
  48.   echo "an archive named in the form mysql<suffix>-<version>-noinstall.zip"
  49.   echo "Takes the following arguments:"
  50.   echo ""
  51.   echo "  --dirname  Directory to use for copying files"
  52.   echo "  --extra    Directory to get extra files from"
  53.   echo "  --suffix   Name to append to 'mysql' for this binary"
  54.   echo "  --help     Show this help message"
  55.   exit 0
  56. }
  57.  
  58. #
  59. # Parse the input arguments
  60. #
  61.  
  62. parse_arguments() {
  63.   for arg do
  64.     case "$arg" in
  65.       --debug)    DEBUG=1;;
  66.       --extra=*) EXTRA=`echo "$arg" | sed -e "s;--extra=;;"` ;;
  67.       --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
  68.       --dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;;
  69.       --help)     show_usage ;;
  70.       *)
  71.   echo "Unknown argument '$arg'"
  72.   exit 1
  73.       ;;
  74.     esac
  75.   done
  76. }
  77.  
  78. parse_arguments "$@"
  79.  
  80. if [ -z "$DIRNAME" ]; then
  81.   $DIRNAME="dist"
  82. fi
  83.  
  84. print_debug "Making directories"
  85. mkdir $DIRNAME
  86. $DIRNAME="$DIRNAME/mysql-$version"
  87. mkdir $DIRNAME
  88.  
  89. for dir in bin lib lib/opt lib/debug Embedded Embedded/DLL Embedded/DLL/debug Embedded/DLL/release Embedded/static Embedded/static/release examples examples/libmysqltest
  90. do
  91.   mkdir $DIRNAME/$dir
  92. done
  93.  
  94. if [ $EXTRA ]; then
  95.   print_debug "Copying extra files"
  96.   cp -fr $EXTRA/* $DIRNAME
  97. fi
  98.  
  99. # Dirs to be copied as-is
  100. for dir in data Docs include scripts share
  101. do
  102.   print_debug "Copying $dir to $DIRNAME/"
  103.   cp -fr $dir $DIRNAME
  104. done
  105.  
  106. print_debug "Copying tests to $DIRNAME/examples/"
  107. cp -fr tests $DIRNAME/examples
  108.  
  109. print_debug "Copying sql-bench to $DIRNAME/bench"
  110. mkdir $DIRNAME/bench
  111. cp -fr sql-bench/* $DIRNAME/bench
  112.  
  113. print_debug "Copying support-files to $DIRNAME"
  114. cp support-files/* $DIRNAME
  115.  
  116. # Files for bin
  117. for i in client_release/* client_debug/mysqld.exe lib_release/libmySQL.dll
  118. do
  119.   print_debug "Copying $i to $DIRNAME/bin"
  120.   cp $i $DIRNAME/bin
  121. done
  122.  
  123. # Files for include
  124. for i in libmysql/libmysql.def libmysqld/libmysqld.def
  125. do
  126.   print_debug "Copying $i to $DIRNAME/include"
  127.   cp $i $DIRNAME/include
  128. done
  129.  
  130. # Windows users are used to having dbug.h ?
  131. cp include/my_dbug.h $DIRNAME/include/dbug.h
  132.  
  133. # Libraries found in lib_release and lib_debug
  134. for i in libmySQL.dll libmysql.lib zlib.lib mysqlclient.lib mysys.lib regex.lib strings.lib
  135. do
  136.   print_debug "Copying lib_release/$i to $DIRNAME/lib/opt"
  137.   cp lib_release/$i $DIRNAME/lib/opt
  138.   print_debug "Copying lib_debug/$i to $DIRNAME/lib/debug"
  139.   cp lib_debug/$i $DIRNAME/lib/debug
  140. done
  141.  
  142. print_debug "Copying lib_release/mysys-max.lib to $DIRNAME/lib/opt"
  143. cp lib_release/mysys-max.lib $DIRNAME/lib/opt
  144.  
  145. # Embedded server
  146. for i in libmysqld.dll libmysqld.lib libmysqld.exp
  147. do
  148.   print_debug "Copying lib_release/$i to $DIRNAME/Embedded/DLL/release"
  149.   cp lib_release/$i $DIRNAME/Embedded/DLL/release
  150.   print_debug "Copying lib_debug/$i to $DIRNAME/Embedded/DLL/debug"
  151.   cp lib_debug/$i $DIRNAME/Embedded/DLL/debug
  152. done
  153.  
  154. # Static embedded
  155. print_debug "Copying lib_release/mysqlserver.lib to $DIRNAME/Embedded/static/release"
  156. cp lib_release/mysqlserver.lib $DIRNAME/Embedded/static/release
  157.  
  158. # libmysqltest
  159. for i in mytest.c mytest.dsp mytest.dsw mytest.exe
  160. do
  161.   print_debug "Copying libmysqltest/release/$i to $DIRNAME/examples/libmysqltest"
  162.   cp libmysqltest/release/$i $DIRNAME/examples/libmysqltest
  163. done
  164.  
  165. print_debug "Copying README.txt"
  166. cp README.txt $DIRNAME
  167.  
  168. if [ -f MySQLEULA.txt ]; then
  169.   print_debug "Commercial version: copying MySQLEULA.txt"
  170.   cp MySQLEULA.txt $DIRNAME
  171.   rm $DIRNAME/Docs/COPYING
  172. else
  173.   print_debug "GPL version: copying COPYING"
  174.   cp Docs/COPYING $DIRNAME
  175. fi
  176.  
  177. print_debug "Invoking zip to package the binary"
  178. zip -r mysql$SUFFIX-$version-win-noinstall.zip $DIRNAME
  179.  
  180. print_debug "Deleting intermediate directory"
  181. rm -rf $DIRNAME
  182.